﻿<%@ Page Title="" EnableEventValidation="false" ValidateRequest="false" Language="C#"
    MasterPageFile="~/MasterPage/Master.Master" AutoEventWireup="true" CodeBehind="wFrmRelacionarArticulo.aspx.cs"
    Inherits="Crosland.Automotriz.Web.Repuestos.wFrmRelacionarArticulo" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<asp:Content ID="cGeneral" ContentPlaceHolderID="cphMain" runat="server">
    <script type="text/javascript">

        function abrirDialogo() {
            $find('mpeArticulo').show();
        }
        
    </script>
    <script language="javascript" type="text/javascript">

        function confirmSubmit2() {
            $.prompt('Está seguro de querer eliminar ?'
            , {
                buttons: { Ok: true, Cancel: false }
                , prefix: 'cleanblue',
                callback: confirmSubmitResult
            }
        );
            return false;
        }


        //        function confirmSubmitResult(v, m, f) {
        //            if (v) //post back if the user clicked OK
        //                $('#<%= btneliminacion.ClientID %>').click();
        //        }  


 
    </script>
    <div class="main-header" style="width: 100%;">
        <div class="main-titulo">
            Relacionar Articulos</div>
    </div>
    <div class="content-form">
        <table style="width: 100%;">
            <tr>
                <td colspan="3">
                    <table>
                        <tr>
                            <td>
                                <dx:ASPxButton ID="CmdNuevo" runat="server" CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css"
                                    CssPostfix="Office2010Blue" SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css"
                                    Text="Nuevo" OnClick="CmdNuevo_Click">
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnModificarArt" runat="server" Text="Modificar" CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css"
                                    CssPostfix="Office2010Blue" OnClick="btnModificarArt_Click" SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css">
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="cmdEliminar" runat="server" CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css"
                                    CssPostfix="Office2010Blue" SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css"
                                    Text="Eliminar" AutoPostBack="False">
                                    <ClientSideEvents Click="function(s, e) {
	popupmsj.Show();
}" />
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="cmdSalir" runat="server" CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css"
                                    CssPostfix="Office2010Blue" OnClick="cmdSalir_Click" SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css"
                                    Text="Salir">
                                </dx:ASPxButton>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="width: 100%;">
                        <dx:ASPxGridView ID="dgDetalleMaeSus" runat="server" AutoGenerateColumns="False"
                            CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css" CssPostfix="Office2010Blue"
                            Style="width: 100%;" KeyFieldName="COD_MATERIAL" OnAfterPerformCallback="dgDetalleMaeSus_AfterPerformCallback"
                            OnPageIndexChanged="dgDetalleMaeSus_PageIndexChanged">
                            <Columns>
                                <dx:GridViewDataTextColumn FieldName="COD_MATERIAL" VisibleIndex="0" Caption="Código"
                                    ToolTip="Codigo material">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inv&#225;lido">
                                            <RegularExpression ErrorText="Fall&#243; la validaci&#243;n de expresi&#243;n Regular">
                                            </RegularExpression>
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="COD_MATERIAL_SUS" VisibleIndex="3" Caption="Código"
                                    ToolTip="Codigo sustituto" Width="80px">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inv&#225;lido">
                                            <RegularExpression ErrorText="Fall&#243; la validaci&#243;n de expresi&#243;n Regular">
                                            </RegularExpression>
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="DESCRIPCION" VisibleIndex="7" Caption="Tipo"
                                    ToolTip="Descripción tipo sustituto">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inv&#225;lido">
                                            <RegularExpression ErrorText="Fall&#243; la validaci&#243;n de expresi&#243;n Regular">
                                            </RegularExpression>
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="CANTIDAD" VisibleIndex="10" Caption="Cantidad"
                                    ToolTip="Cantidad " Visible="False">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inv&#225;lido">
                                            <RegularExpression ErrorText="Fall&#243; la validaci&#243;n de expresi&#243;n Regular">
                                            </RegularExpression>
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="DESCRIPCION_MAE" VisibleIndex="1" Caption="Descripción"
                                    ToolTip="Descripción material">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inv&#225;lido">
                                            <RegularExpression ErrorText="Fall&#243; la validaci&#243;n de expresi&#243;n Regular">
                                            </RegularExpression>
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="ID_MATERIAL_SUS" Visible="False" 
                                    VisibleIndex="9">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inválido">
                                            <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="ID_MATERIAL" Visible="False" VisibleIndex="6">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inválido">
                                            <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="Modelo" FieldName="Modelo_Princ" VisibleIndex="2">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inválido">
                                            <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="Modelo secundario" FieldName="Modelo_Sus" VisibleIndex="5">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inválido">
                                            <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn Caption="Descripción" FieldName="DESCRIPCION_SUS" ToolTip="Descripción material "
                                    VisibleIndex="4">
                                    <PropertiesTextEdit>
                                        <ValidationSettings ErrorText="Valor inv&#225;lido">
                                            <RegularExpression ErrorText="Fall&#243; la validaci&#243;n de expresi&#243;n Regular">
                                            </RegularExpression>
                                        </ValidationSettings>
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="ID_SUS_ART_MAE" Visible="False" 
                                    VisibleIndex="8">
                                </dx:GridViewDataTextColumn>
                            </Columns>
                            <SettingsBehavior AllowFocusedRow="True" />
                            <SettingsPager PageSize="20">
                                <AllButton Text="All">
                                </AllButton>
                                <NextPageButton Text="Next &gt;">
                                </NextPageButton>
                                <PrevPageButton Text="&lt; Prev">
                                </PrevPageButton>
                            </SettingsPager>
                            <Settings ShowFilterRow="True" />
                            <SettingsLoadingPanel Text="Cargando&amp;hellip;"></SettingsLoadingPanel>
                            <Images SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css">
                                <LoadingPanelOnStatusBar Url="~/App_Themes/Office2010Blue/GridView/Loading.gif">
                                </LoadingPanelOnStatusBar>
                                <LoadingPanel Url="~/App_Themes/Office2010Blue/GridView/Loading.gif">
                                </LoadingPanel>
                            </Images>
                            <ImagesFilterControl>
                                <LoadingPanel Url="~/App_Themes/Office2010Blue/GridView/Loading.gif">
                                </LoadingPanel>
                            </ImagesFilterControl>
                            <Styles CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css" CssPostfix="Office2010Blue">
                                <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                </Header>
                                <LoadingPanel ImageSpacing="5px">
                                </LoadingPanel>
                            </Styles>
                            <StylesPager>
                                <PageNumber ForeColor="#3E4846">
                                </PageNumber>
                                <Summary ForeColor="#1E395B">
                                </Summary>
                            </StylesPager>
                            <StylesEditors ButtonEditCellSpacing="0">
                                <ProgressBar Height="21px">
                                </ProgressBar>
                            </StylesEditors>
                        </dx:ASPxGridView>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btneliminacion" runat="server" BackColor="White" ForeColor="White"
                        Height="1px" OnClick="btneliminacion_Click" Width="1px" />
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <!-- Dialogo de consulta de Stock -->
    <div class="modal-dialog" runat="server" id="divArticulo" style="display: none; width: 70%">
        <div class="popup-header">
            <div class="popup-title" runat="server" id="divMoveArticulo">
                Agregar Nueva relacion...
            </div>
            <div class="popup-close" runat="server" id="divCloseArticulo">
            </div>
        </div>
    </div>
    <!-- Dialogo para mostrar los mensajes -->
    <div class="modal-dialog" runat="server" id="divError" style="display: none; width: 500px">
        <div class="popup-header">
            <div class="popup-title" runat="server" id="divMoveError">
                Mensaje del Sistema
            </div>
            <div class="popup-close" runat="server" id="divCloseError">
            </div>
        </div>
        <div class="popup-content">
            <asp:UpdatePanel ID="upError" runat="server">
                <ContentTemplate>
                    <asp:Panel ID="pnlMsgError" CssClass="content-message" runat="server">
                        <asp:Label ID="lblCorregir" runat="server" Text="Por favor corrija lo siguiente:"></asp:Label>
                    </asp:Panel>
                    <div style="height: 20px; clear: both">
                    </div>
                    <asp:Label ID="lblErrores" runat="server" Text=""></asp:Label>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    <dx:ASPxPopupControl ID="popupmsj" runat="server" AllowDragging="True" ClientInstanceName="popupmsj"
        CloseAction="CloseButton" CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css"
        CssPostfix="PlasticBlue" EnableViewState="False" HeaderText="Mensaje" LoadingPanelText="Cargando&amp;hellip;"
        Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter"
        SpriteCssFilePath="~/App_Themes/PlasticBlue/{0}/sprite.css" Width="300px">
        <LoadingPanelImage Url="~/App_Themes/PlasticBlue/Web/dvLoading.gif">
        </LoadingPanelImage>
        <CloseButtonStyle>
            <Paddings Padding="0px" />
        </CloseButtonStyle>
        <ContentStyle>
            <BorderBottom BorderColor="#E0E0E0" BorderStyle="Solid" BorderWidth="1px" />
        </ContentStyle>
        <HeaderStyle>
            <Paddings PaddingBottom="4px" PaddingLeft="10px" PaddingRight="4px" PaddingTop="4px" />
        </HeaderStyle>
        <ContentCollection>
            <dx:PopupControlContentControl ID="PopupControlContentControl5" runat="server" SupportsDisabledAttribute="True">
                <br />
                <dx:ASPxPanel ID="ASPxPanel2" runat="server" DefaultButton="btCreate">
                    <PanelCollection>
                        <dx:PanelContent ID="Panelpopup" runat="server">
                            <table>
                                <tr>
                                    <td colspan="3">
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ¿Estas seguro de eliminar este registro ?&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
                                    </td>
                                    <td>
                                        <dx:ASPxButton ID="btnPopAceptar" runat="server" Text="Aceptar" AutoPostBack="False"
                                            CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css" CssPostfix="Office2010Blue"
                                            SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css" ClientInstanceName="btnPopAceptar"
                                            OnClick="btnPopAceptar_Click" Width="10px">
                                            <ClientSideEvents Click="function(s, e) {
	
	e.processOnServer = true;
popupmsj.Hide();
}" />
                                        </dx:ASPxButton>
                                    </td>
                                    <td>
                                        <dx:ASPxButton ID="btnPopCancelar" runat="server" CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css"
                                            CssPostfix="Office2010Blue" SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css"
                                            Text="Cancelar" AutoPostBack="False" Width="10px">
                                            <ClientSideEvents Click="function(s, e) {
	popupmsj.Hide();
}" />
                                        </dx:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </dx:PanelContent>
                    </PanelCollection>
                </dx:ASPxPanel>
            </dx:PopupControlContentControl>
        </ContentCollection>
    </dx:ASPxPopupControl>
</asp:Content>
